import json


class SelectArea:

    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {},
            "optional": {
                "area_list": ("ALIST",),
                "width": ("INT", {"default": 512, "min": 0, "max": 2048}),
                "height": ("INT", {"default": 512, "min": 0, "max": 2048}),
            },
        }

    RETURN_TYPES = ("ALIST",)
    RETURN_NAMES = ("area_list",)

    FUNCTION = "handle"

    OUTPUT_NODE = True

    CATEGORY = "fcl/select_area"

    history_dict = {}

    def handle(self, area_list="", width=512, height=512):
        print("开始。。。。", width, height)
        print(area_list)
        ret_list = []
        if area_list:
            ret_list = json.loads(area_list)
        return (ret_list,)


NODE_CLASS_MAPPINGS = {"FCL_SELECT_AREA": SelectArea}

NODE_DISPLAY_NAME_MAPPINGS = {"FCL_SELECT_AREA": "fcl dev select area"}
